package org.sdfc.model.dfc

import com.documentum.fc.client.IDfTypedObject
import com.documentum.fc.common.IDfId
import com.documentum.fc.common.IDfTime

import org.sdfc.model.attr._

/** DfcTypedObject implementation which adapts<br>
 *  an IDfTypedObject into an DfcTypedObject.
 */
abstract class DfcTypedObjectAdaptor extends DfcTypedObject {
  
  /** Returns the underlying IDfTypedObject.
   */
  protected def underlying : IDfTypedObject
  
  
  /** Reads the value of a SingleBooleanAttribute. */
  def getBoolean(attr : SingleBooleanAttribute) : Boolean = underlying.getBoolean(attr.name)
  
  /** Reads the value of a SingleIntAttribute. */
  def getInt(attr : SingleIntAttribute) : Int = underlying.getInt(attr.name)
  
  /** Reads the value of a SingleStringAttribute. */
  def getString(attr : SingleStringAttribute) : String = underlying.getString(attr.name)
  
  /** Reads the value of a SingleIdAttribute. */
  def getId(attr : SingleIdAttribute) : IDfId = underlying.getId(attr.name)
  
  /** Reads the value of a SingleTimeAttribute. */
  def getTime(attr : SingleTimeAttribute) : IDfTime = underlying.getTime(attr.name)
  
  /** Reads the value of a SingleDoubleAttribute. */
  def getDouble(attr : SingleDoubleAttribute) : Double = underlying.getDouble(attr.name)
  
  
  /** Counts the values of a RepeatingAttribute. */
  def getValueCount(attr : RepeatingAttribute[_]) : Int = underlying.getValueCount(attr.name)
  
  /** Reads the value of a RepeatingBooleanAttribute at a given index. */
  def getRepeatingBoolean(attr : RepeatingBooleanAttribute, index : Int) : Boolean = underlying.getRepeatingBoolean(attr.name, index)
  
  /** Reads the value of a RepeatingIntAttribute at a given index. */
  def getRepeatingInt(attr : RepeatingIntAttribute, index : Int) : Int = underlying.getRepeatingInt(attr.name, index)
  
  /** Reads the value of a RepeatingStringAttribute at a given index. */
  def getRepeatingString(attr : RepeatingStringAttribute, index : Int) : String = underlying.getRepeatingString(attr.name, index)
  
  /** Reads the value of a RepeatingIdAttribute at a given index. */
  def getRepeatingId(attr : RepeatingIdAttribute, index : Int) : IDfId = underlying.getRepeatingId(attr.name, index)
  
  /** Reads the value of a RepeatingTimeAttribute at a given index. */
  def getRepeatingTime(attr : RepeatingTimeAttribute, index : Int) : IDfTime = underlying.getRepeatingTime(attr.name, index)
  
  /** Reads the value of a RepeatingDoubleAttribute at a given index. */
  def getRepeatingDouble(attr : RepeatingDoubleAttribute, index : Int) : Double = underlying.getRepeatingDouble(attr.name, index)
  
  
  /** Searchs the values of a RepeatingBooleanAttribute for a given one and returns its index, -1 for not found. */
  def findBoolean(attr : RepeatingBooleanAttribute, value : Boolean) : Int = underlying.findBoolean(attr.name, value)
  
  /** Searchs the values of a RepeatingIntAttribute for a given one and returns its index, -1 for not found. */
  def findInt(attr : RepeatingIntAttribute, value : Int) : Int = underlying.findInt(attr.name, value)
  
  /** Searchs the values of a RepeatingStringAttribute for a given one and returns its index, -1 for not found. */
  def findString(attr : RepeatingStringAttribute, value : String) : Int = underlying.findString(attr.name, value)
  
  /** Searchs the values of a RepeatingIdAttribute for a given one and returns its index, -1 for not found. */
  def findId(attr : RepeatingIdAttribute, value : IDfId) : Int = underlying.findId(attr.name, value)
  
  /** Searchs the values of a RepeatingTimeAttribute for a given one and returns its index, -1 for not found. */
  def findTime(attr : RepeatingTimeAttribute, value : IDfTime) : Int = underlying.findTime(attr.name, value)
  
  /** Searchs the values of a RepeatingDoubleAttribute for a given one and returns its index, -1 for not found. */
  def findDouble(attr : RepeatingDoubleAttribute, value : Double) : Int = underlying.findDouble(attr.name, value)
  
}
